clear all

*set working directory
use "data_study1.dta"

net describe polychoric, from(https://staskolenikov.net/stata)

*scale order 
gen generalfirst=0
replace generalfirst=1 if FL_25_DO_GeneralViolence==1 | FL_30_DO_GeneralViolence==1
recode generalfirst 1=0 0=1, gen(partisanfirst)

drop *DO*

** Attention **
rename BPAQ_2 check1
recode check1 1=1 *=0
tab check1
tab opencheck
tab check1 opencheck, col chi2
gen satisficingindex=opencheck+check1
recode satisficingindex 0/1=0 2=1, gen(satisficingindex_di)
recode satisficingindex_di 1=0 0=1

** Trolling **
recode lowincidence* (.=0)
gen lowincsum=lowincidence_2+lowincidence_3+lowincidence_8+lowincidence_4+lowincidence_7+lowincidence_9
tab lowincsum

replace trolling=(trolling-1)/4

gen trollindex_di=0
replace trollindex_di=1 if lowincsum>1
replace trollindex_di=1 if trolling>.25

** any low-quality indicator
gen satisficer=0
replace satisficer=1 if check1==0
replace satisficer=1 if opencheck==0
replace satisficer=1 if lowincsum>1
replace satisficer=1 if trolling>.25

*dichotomized most harmful actor
recode leastvalid 1=0 2=1, gen(leastvalid01)


** LL **
recode llviolence* (4=5) (5=4) (6=3) (7=2) (8=1)
gen LLsum=(llviolence_1+llviolence_2+llviolence_3+llviolence_4+llviolence_5+llviolence_6+llviolence_7+llviolence_8+llviolence_9+llviolence_10 - 10)/40

forval x=1/10 {
	gen LL`x'=(llviolence_`x'-1)/4
}

*dichotomizing LL
forval x=1/10 {
egen ll_`x'=rowfirst(llviolence_`x')
	recode ll_`x' 1/3=0 4/5=1, gen(lldi_`x')
}

*percentage endorsing
gen llperc=.
gen llperc_lo=.
gen llperc_hi=.
forval x=1/10 {
	ci means lldi_`x' if leastvalid==2
	replace llperc=r(mean) in `x'
	replace llperc_lo=r(lb) in `x'
	replace llperc_hi=r(ub) in `x'
}

*abstract violence
recode genviolence* (1=5) (2=4) (4=2) (5=1)
gen GVsum=(genviolence_for_1+genviolence_for_2+genviolence_for_3 - 3)/12

forval x=1/3 {
	gen gv`x'=(genviolence_for_`x'-1)/4
}

*partisan violence
forval x=1/4 {
egen partyviolence`x'=rowfirst(partyviolence_d`x' partyviolence_r`x')
}

replace partyviolence1=(partyviolence1-1)/3
replace partyviolence2=(partyviolence2-1)/3
replace partyviolence3=(partyviolence3-1)/4
replace partyviolence4=(partyviolence4-1)/4

alpha partyviolence1-partyviolence4, item casewise gen(PVsum)


** dichotomous scores
recode GVsum 0=0 .01/1=1, gen(GV_di)
recode PVsum 0=0 .01/1=1, gen(PV_di)
recode LLsum 0=0 .01/1=1, gen(LL_di)

** difference scores
gen LL_PV_diff=LLsum-PVsum
gen LL_GV_diff=LLsum-GVsum
gen GV_PV_diff=GVsum-PVsum

** Conspiracies **
recode conspre* (1=5) (2=4) (4=2) (5=1)
alpha conspre*, item casewise gen(Conspre)
replace Conspre=(Conspre-1)/4

*trait aggression
recode BPAQ_1 BPAQ_3 BPAQ_4 BPAQ_5 (1=6) (2=5) (3=4) (4=3) (5=2) (6=1)
alpha BPAQ*, item casewise gen(TraitAgg)
replace TraitAgg=(TraitAgg-1)/5


*PID
gen PID=pid
recode PID 1=2 2=6 3/4=4
recode PID 2=1 if pidd==1
recode PID 6=7 if pidr==1
recode PID 4=3 if pidi==1
recode PID 4=5 if pidi==2

gen ideoext=(abs(ideo-4))/3

*PID social
recode repidentity* demidentity* (1=4) (2=3) (3=2) (4=1)
forval x=1/4 {
	egen pididentity`x'=rowfirst(repidentity_`x' demidentity_`x')
}
alpha pididentity*, item casewise gen(PSIDext)
replace PSIDext=(PSIDext-1)/3

alpha repidentity*, item casewise gen(PSIDr)
alpha demidentity*, item casewise gen(PSIDd)
replace PSIDr=(PSIDr-1)/3
replace PSIDd=(PSIDd-1)/-3
egen PSID=rowfirst(PSIDd PSIDr)
drop PSIDd PSIDr


** Demos **
recode race 2/5=0, gen(white)
recode sex 2/3=0, gen(male)

*most harmful actor selected
gen LL_Biden=0
replace LL_Biden=1 if leastliked_clean1=="Joe Biden"
gen LL_Trump=0
replace LL_Trump=1 if leastliked_clean1=="Donald Trump"



**************
** Analysis **
**************

*demos
tab sex
tab age
tab race
tab educ
tab pid
tab ideo

*demos - with exclusions
tab sex if leastvalid==2
tab age if leastvalid==2
tab race if leastvalid==2
tab educ if leastvalid==2
tab pid if leastvalid==2
tab ideo if leastvalid==2

replace age=(age-1)/8


*distribution of most harmful actors
tab leastliked_clean1


*rates of problematic responding
tab satisficingindex_di
tab trollindex_di
tab satisficer

*rates of valid most harmful actor
tab leastvalid

*predictors of valid most harmful actor
logit leastvalid01 PSID PSIDext satisficingindex_di trollindex_di interest age white male


*most harmful actors
tab leastliked_clean1 if leastvalid==2


*figure 2
gen x=_n
replace x=. if _n>10
recode x 8=4 7=1 6=7 5=6 4=8 3=5 2=3 1=2
label define actionl 1 "Kill" 2 "Hit with car" 3 "Throw rocks and bottles" 4 "Punch in the face" 5 "Brick through window" 6 "Protest with weapons" 7 "Threatening package" 8 "Threatening messages" 9 "Share location" 10 "Curse in face", replace
label values x actionl

twoway (bar llperc x, horiz xtitle("Proportion Supporting") ytitle("") legend(off) xlab(0(.1).3) ylab(2 "Kill" 3 "Hit with car" 5 "Throw rocks and bottles" 8 "Punch in the face" 6 "Brick through window" 7 "Protest with weapons" 1 "Threatening package" 4 "Threatening messages" 9 "Share location" 10 "Curse in face") saving(fig2.gph, replace)) (rcap llperc_hi llperc_lo x, horiz col(gs5))


*factor structure of MHA scale
polychoric llviolence_* if leastvalid==2
display r(sum_w)
global N=r(sum_w)
matrix r=r(R)
factormat r, n($N) 
factormat r, n($N) factors(1)



*figure 3
hist LLsum if leastvalid==2, freq xtitle("Support for Aggression") subtitle("Most Harmful") ylab(0(250)750) xlab(0(.25)1) saving(fig3_mh.gph, replace)
hist GVsum if leastvalid==2, freq xtitle("Support for Aggression") subtitle("Abstract") ylab(0(250)750) xlab(0(.25)1) saving(fig3_av.gph, replace)
hist PVsum if leastvalid==2, freq xtitle("Support for Aggression") subtitle("Partisan") ylab(0(250)750) xlab(0(.25)1) saving(fig3_pv.gph, replace)
graph combine fig3_mh.gph fig3_av.gph fig3_pv.gph, rows(1) 


*figure 4
gen propgv=.
gen lbgv=.
gen ubgv=.

gen sat=0 in 1
replace sat=1 in 2

ci proportion satisficer if GV_di==0
replace propgv=r(mean) in 1
replace lbgv=r(lb) in 1
replace ubgv=r(ub) in 1

ci proportion satisficer if GV_di==1
replace propgv=r(mean) in 2
replace lbgv=r(lb) in 2
replace ubgv=r(ub) in 2

twoway (bar propgv sat, ylab(0(.1).4) xlabel(0 `""Rejects All" "Aggression""' 1 `""Does Not Reject" "All Aggression""') legend(off) ytitle("Proportion Satisficers") xtitle("")) (rcap lbgv ubgv sat, lcol(black)), saving(fig4_gv.gph, replace) subtitle("Abstract")

gen proppv=.
gen lbpv=.
gen ubpv=.

ci proportion satisficer if PV_di==0
replace proppv=r(mean) in 1
replace lbpv=r(lb) in 1
replace ubpv=r(ub) in 1

ci proportion satisficer if PV_di==1
replace proppv=r(mean) in 2
replace lbpv=r(lb) in 2
replace ubpv=r(ub) in 2

twoway (bar proppv sat, ylab(0(.1).4) xlabel(0 `""Rejects All" "Aggression""' 1 `""Does Not Reject" "All Aggression""') legend(off) ytitle("Proportion Satisficers") xtitle("")) (rcap lbpv ubpv sat, lcol(black)), saving(fig4_pv.gph, replace) subtitle("Partisan")

gen propll=.
gen lbll=.
gen ubll=.

ci proportion satisficer if LL_di==0
replace propll=r(mean) in 1
replace lbll=r(lb) in 1
replace ubll=r(ub) in 1

ci proportion satisficer if LL_di==1
replace propll=r(mean) in 2
replace lbll=r(lb) in 2
replace ubll=r(ub) in 2

twoway (bar propll sat, ylab(0(.1).4) xlabel(0 `""Rejects All" "Aggression""' 1 `""Does Not Reject" "All Aggression""') legend(off) ytitle("Proportion Satisficers") xtitle("")) (rcap lbll ubll sat, lcol(black)), saving(fig4_mh.gph, replace) subtitle("Most Harmful")

graph combine fig4_mh.gph fig4_gv.gph fig4_pv.gph, rows(1)


*figure 5
cor LLsum PVsum GVsum if leastvalid==2

twoway scatter LLsum PVsum if leastvalid==2, jitter(5) msize(small) mcol(%30) xtitle("Partisan Violence") ytitle("Most Harmful Actor") legend(off) || lowess LLsum PVsum,  saving(fig5_llpv.gph, replace)

twoway scatter LLsum GVsum if leastvalid==2, jitter(5) msize(small) mcol(%30) xtitle("Abstract Violence") ytitle("Most Harmful Actor")  legend(off) || lowess LLsum GVsum, saving(fig5_llgv.gph, replace)

twoway scatter GVsum PVsum if leastvalid==2, jitter(5) msize(small) mcol(%30) xtitle("Partisan Violence") ytitle("Abstract Violence") legend(off) || lowess GVsum PVsum, saving(fig5_gvpv.gph, replace)

graph combine fig5_llgv.gph fig5_llpv.gph fig5_gvpv.gph, rows(1) 


*figure 6
tobit LLsum PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2, ul(1) ll(0)
est store ll
tobit GVsum PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2, ul(1) ll(0)
est store gv
tobit PVsum PSID PSIDext ideoext  Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2, ul(1) ll(0)
est store pv

coefplot ll, bylabel("Most Harmful") || gv, bylabel("Abstract") || pv, bylabel("Partisan") byopts(rows(1)) xline(0) drop(_cons) coeflabels(PSID="Partisanship" PSIDext="Partisan Strength" ideoext="Ideological Extremity" Conspre="Conspiracy Belief" TraitAgg="Trait Aggression" satisficingindex_di="Satisficing" trollindex_di="Insincere" Know="Political Knowledge" age="Age" white="White" male="Male") legend(pos(6) rows(1) order(2 "Least-Liked" 4 "Abstract" 6 "Partisan")) saving(s2_coefs_tri.gph, replace) xlab(-.4(.4).6) 


*Party asymmetry driven by Trump
sum LLsum if leastvalid==2 & leastliked_clean1=="Donald Trump"
sum LLsum if leastvalid==2 & leastliked_clean1=="Joe Biden"
sum LLsum if leastvalid==2 & leastliked_clean1!="Donald Trump" & leastliked_clean1!="Joe Biden"

sum PVsum if leastvalid==2 & leastliked_clean1=="Donald Trump"
sum PVsum if leastvalid==2 & leastliked_clean1=="Joe Biden"
sum PVsum if leastvalid==2 & leastliked_clean1!="Donald Trump" & leastliked_clean1!="Joe Biden"

sum GVsum if leastvalid==2 & leastliked_clean1=="Donald Trump"
sum GVsum if leastvalid==2 & leastliked_clean1=="Joe Biden"
sum GVsum if leastvalid==2 & leastliked_clean1!="Donald Trump" & leastliked_clean1!="Joe Biden"

tobit LLsum LL_Biden LL_Trump PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2, ul(1) ll(0)

tobit LLsum LL_Biden LL_Trump PVsum GVsum PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2, ul(1) ll(0)


*Predicting differences between scales

** Difference models
reg LL_PV_diff PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2
est store llpv

reg LL_GV_diff PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2
est store llgv

reg GV_PV_diff PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2
est store gvpv

coefplot llpv, bylabel(Most - Partisan) || llgv, bylabel(Most - Abstract) || gvpv, bylabel(Abstract - Partisan) byopts(rows(1) compact) drop(_cons) coeflabels(PSID="Partisanship" PSIDext="Partisan Strength" ideoext="Ideological Extremity" Conspre="Conspiracy Belief" TraitAgg="Trait Aggression" satisficingindex_di="Satisficing" trollindex_di="Insincere" Know="Political Knowledge" age="Age" white="White" male="Male") xline(0) 


*sensitivity to assumptions about insincere respondents
gen LL_zeroes = LLsum
replace LL_zeroes=0 if (satisficingindex_di==1 | trollindex_di==1 | leastvalid==0)
replace LL_zeroes=. if LLsum==.

gen LL_ones = LLsum
replace LL_ones=1 if (satisficingindex_di==1 | trollindex_di==1 | leastvalid==0)
replace LL_ones=. if LLsum==.

gen LL_nojunk=LLsum if satisficingindex_di==0 & trollindex_di==0 & leastvalid==2

sum LLsum LL_zeroes  LL_ones LL_nojunk
graph bar LLsum LL_nojunk LL_zeroes  LL_ones, ylab(0(.1).4) legend(order(1 "Unaltered" 2 "Dropping Junk" 3 "Recoded to Zero" 4 "Recoded to One") pos(6) rows(1)) saving(LL_insincere.gph, replace) subtitle("Most Harmful")


gen PV_zeroes = PVsum
replace PV_zeroes=0 if (satisficingindex_di==1 | trollindex_di==1 | leastvalid==0)
replace PV_zeroes=. if PVsum==.

gen PV_ones = PVsum
replace PV_ones=1 if (satisficingindex_di==1 | trollindex_di==1 | leastvalid==0)
replace PV_ones=. if PVsum==.

gen PV_nojunk=PVsum if satisficingindex_di==0 & trollindex_di==0 & leastvalid==2

sum PVsum PV_nojunk PV_zeroes  PV_ones 
graph bar PVsum PV_nojunk PV_zeroes  PV_ones, ylab(0(.1).4) legend(order(1 "Unaltered" 2 "Dropping Junk" 3 "Recoded to Zero" 4 "Recoded to One")) saving(PV_insincere.gph, replace) subtitle("Partisan")


gen GV_zeroes = GVsum
replace GV_zeroes=0 if (satisficingindex_di==1 | trollindex_di==1 | leastvalid==0)
replace GV_zeroes=. if GVsum==.

gen GV_ones = GVsum
replace GV_ones=1 if (satisficingindex_di==1 | trollindex_di==1 | leastvalid==0)
replace GV_ones=. if GVsum==.

gen GV_nojunk=GVsum if satisficingindex_di==0 & trollindex_di==0 & leastvalid==2

sum GVsum GV_zeroes  GV_ones 
graph bar GVsum GV_nojunk GV_zeroes  GV_ones, ylab(0(.1).4) legend(order(1 "Unaltered" 2 "Dropping Junk" 3 "Recoded to Zero" 4 "Recoded to One")) saving(GV_insincere.gph, replace) subtitle("Abstract")

grc1leg LL_insincere.gph PV_insincere.gph GV_insincere.gph, legendfrom(LL_insincere.gph) rows(1) subtitle("How Estimates Differ by Assumptions About Satisficers")


*models with and without satisficers and insincere respondents

*LL
tobit LLsum PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2, ul(1) ll(0)
est store ll1
tobit LLsum PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if (leastvalid==2 & satisficingindex_di==0 & trollindex_di==0), ul(1) ll(0)
est store ll2

coefplot ll1 ll2, xline(0) drop(_cons) coeflabels(PID01="Partisan Identity" PSID="Partisanship" PSIDext="Partisan Strength" ideoext="Ideological Extremity" Conspre="Conspiracy Belief" TraitAgg="Trait Aggression" satisficingindex_di="Satisficing" satisficer="Satisficing" trolling="Trolling" trollindex_di="Insincere" Know="Political Knowledge" age="Age" white="White" male="Male") legend(pos(6) rows(1) order(2 "With Satisficers" 4 "Without Satisficers")) subtitle("Predictors of MHA Aggression")


*GV
tobit GVsum PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2, ul(1) ll(0)
est store gv1
tobit GVsum PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if (leastvalid==2 & satisficingindex_di==0 & trollindex_di==0), ul(1) ll(0)
est store gv2

coefplot gv1 gv2, xline(0) drop(_cons) coeflabels(PID01="Partisan Identity" PSID="Partisanship" PSIDext="Partisan Strength" ideoext="Ideological Extremity" Conspre="Conspiracy Belief" TraitAgg="Trait Aggression" satisficingindex_di="Satisficing" satisficer="Satisficing" trogving="Trolling" trollindex_di="Insincere" Know="Political Knowledge" age="Age" white="White" male="Male") legend(pos(6) rows(1) order(2 "With Satisficers" 4 "Without Satisficers")) subtitle("Predictors of Abstract Aggression")

*PV
tobit PVsum PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if leastvalid==2, ul(1) ll(0)
est store pv1
tobit PVsum PSID PSIDext ideoext Conspre TraitAgg ideoext satisficingindex_di trollindex_di age white male if (leastvalid==2 & satisficingindex_di==0 & trollindex_di==0), ul(1) ll(0)
est store pv2

coefplot pv1 pv2, xline(0) drop(_cons) coeflabels(PID01="Partisan Identity" PSID="Partisanship" PSIDext="Partisan Strength" ideoext="Ideological Extremity" Conspre="Conspiracy Belief" TraitAgg="Trait Aggression" satisficingindex_di="Satisficing" satisficer="Satisficing" tropving="Trolling" trollindex_di="Insincere" Know="Political Knowledge" age="Age" white="White" male="Male") legend(pos(6) rows(1) order(2 "With Satisficers" 4 "Without Satisficers")) subtitle("Predictors of Partisan Aggression") xlab(-.6(.3).6)


